package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by oyhk on 2016/11/27.
 *
 * 商品库存表
 */
@Entity
@Table(name = "product_quantity")
@DynamicInsert
@DynamicUpdate
public class ProductQuantity extends IDEntityMall {


    @Column(columnDefinition = "bigint comment '产品id'", unique = true)
    private Long productId;
    @Column(columnDefinition = "bigint comment '库存'")
    private Long quantity;
    @Column(columnDefinition = "bigint default 0 comment '冻结库存'")
    private Long frozenQuantity = 0L;
    @Column(columnDefinition = "bigint comment '商家id'")
    private Long merchantId;
    @Column(columnDefinition = "bigint comment '平台id'")
    private Long mallId;


    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public Long getFrozenQuantity() {
        return frozenQuantity;
    }

    public void setFrozenQuantity(Long frozenQuantity) {
        this.frozenQuantity = frozenQuantity;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getQuantity() {
        return quantity;
    }

    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    @Override
    public String toString() {
        return "ProductQuantity{" +
                "productId=" + productId +
                ", id=" + id +
                ", quantity=" + quantity +
                ", frozenQuantity=" + frozenQuantity +
                ", dateCreated=" + dateCreated +
                ", merchantId=" + merchantId +
                ", lastUpdated=" + lastUpdated +
                ", mallId=" + mallId +
                ", isDelete=" + isDelete +
                ", version=" + version +
                '}';
    }
}
